<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page session="false" contentType="text/html; charset=UTF-8"%>
<html>
<head>
<title>Home</title>
<script src='<c:url value="/resources/javascript/jquery-1.11.0.js"/>'
	type="text/javascript"></script>
<script type="text/javascript">
	$().ready(function() {
		$("#btn_go").click(function() {
			var userName = $("#txt_username").val();
			$.get("/backend/user/name/" + userName, function(data) {
				$("#p_username").text(data.name);
			})
		})

		$("#btn_clear").click(function() {
			$("#p_username").text("");

		})

	})
</script>
</head>
<body>
	<h1>Hello User!</h1>
	<h6>Search User</h6>
	<p>Please input a user name to find</p>
	<input type="text" id="txt_username" />
	<button id="btn_clear">Clear!</button>
	<button id="btn_go">Go!</button>
	<span>通过Ajax调用返回</span>
	<br />
	<P>Hello ${name}.</P>
	<P>
		来自Ajax返回的后台搜索结果:<strong id="p_username"></strong>
	</P>
	<br/>
	<br/>
	<div>
		<form action="/backend/user" method="post">
		<p>Add User Demo</p>
		<div><p>UserName</p><input type="text" id="user_name" name="username"/></div>
		<div><p>Password</p><input type="text" id="user_password" name="password"/></div>
		<div><p>Email</p><input type="text" id="user_email" name="email"/></div>
		<input type="submit" id="submit_user_btn" value="Add"/>
		</form>
	</div>
</body>
</html>
